import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/18 8:15
 * @description
 */
public class Bank {
    public static void main(String[] args) {
    }
    long[] A;
    int n;
    public Bank(long[] balance) {
        this.A = balance;
        this.n = balance.length;
    }
    public boolean transfer(int account1, int account2, long money) {
        if (account1 < 1 || account1 > n || account2 < 1 || account2 > n || A[account1-1] < money) {
            return false;
        }
        A[account1-1] -= money;
        A[account2-1] += money;
        return true;
    }
    public boolean deposit(int account, long money) {
        if (account < 1 || account > n) {
            return false;
        }
        A[account-1] += money;
        return true;
    }
    public boolean withdraw(int account, long money) {
        if (account < 1 || account > n || A[account - 1] < money) {
            return false;
        }
        A[account - 1] -= money;
        return true;
    }
}
